The approaches described in this section could be pursued, but are not necessarily approaches that have been previously conceived or pursued. Therefore, unless otherwise indicated herein, the approaches described in this section are not prior art to the claims in this application and are not admitted to be prior art by inclusion in this section.
A command line interface (CLI) is a facility of a computer program for communicating with a computing device, computer operating system or other software by typing in commands to perform specific tasks. The method of instructing an electronic device, such as a computer, to perform a specific task is generally referred to as “entering” a command.
In some cases, the CLI waits while a user types a command until the user gives an indication that the command is ready to be executed. For example, the CLI may wait until a carriage return, newline or other character is received from the user. At that point, the CLI may parse the text constituting the command in order to determine whether the text matches the syntax of a command supported by the CLI.
In some implementations, the syntax of a command may define many distinct parts such as the name, options, and arguments of a command. Where the name serves to identify a command, the options and arguments modify the execution of a command. For example, when a command is executed, the program or code that performs the task may be implemented to handle the task in a multitude of different ways. Often times, the program will use one particular method by default when handling the task. However, the options of a command may allow a user to specify a method that deviates from the default method. For example, a command may perform the task of returning a list of files in a directory. By default the files may be returned in alphabetical order, but an option may exist that causes the files to be returned in a different order, such as by modification date. Arguments, on the other hand, often times allow the user to specify targets for the task that the program or code performs. For example, a command may copy a file from one location to another. Such a command may require two arguments, the name of the file to be copied and the location where the copy should be stored.
However, options and arguments are not limited to the roles that have been described. Both options and arguments serve as means of relaying information to the program or code that is performing the task. Consequently, it is up to the program or code to interpret the effect that the options and arguments should have.
If the parsing is successful, the CLI may invoke the program that implements the command and pass any options and arguments to the program. If the program produces output during the execution of the command, the CLI may display that output to the user. However, in some cases, the CLI may be able to execute the command itself, provided that the CLI contains the code necessary to perform the task or can import the code from a source such as a library.
A CLI is a powerful tool, but the users of a CLI must know the commands that are supported by the CLI as well as the correct syntax for entering those commands. Commands typically are formed using abbreviated, truncated or otherwise modified natural language words, or code words, values, and parameters. Typically the form or format of a command, and all possible values for parameters, are difficult for human users to memorize or remember. Consequently, the learning curve for a novice user may be very steep. Furthermore, even experienced users will often times forget commands that are not used regularly. Thus, users may end up spending a significant amount of time researching commands and syntax.